/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ui.common;


import javax.faces.application.FacesMessage;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.Transaction;
import util.HibernateUtil;

/**
 *
 * @author Neo
 */
@ManagedBean
@RequestScoped
public class AbstractUIBean {
    public FacesContext facesContext = FacesContext.getCurrentInstance();
    public HttpServletRequest request = (HttpServletRequest) facesContext.getExternalContext().getRequest();
    public HttpServletResponse response = (HttpServletResponse) facesContext.getExternalContext().getResponse();
    public HttpSession session = request.getSession();
    public ServletContext servletContext = request.getServletContext();
    public ExternalContext exContext = facesContext.getExternalContext();
    String APP_NAME = "mailserver";
    
    
    
    public Session hbSession = HibernateUtil.getSessionFactory().openSession();
    public Transaction hbTransaction;
    public Query hbQuery;
    
    public void showPrimeMessage(String summary, String content) {
        FacesContext context = FacesContext.getCurrentInstance();
        context.addMessage(null, new FacesMessage(summary, content));
    }
    
    String msg_error;
    public AbstractUIBean() {
    
    }
    
    
}
